
// 治安专题
let chart1 = echarts.init(document.getElementById('Chart-left1'));
option1 = {
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['2013', '2014', '2015', '2016', '2017'],
		axisLine: {
					lineStyle: {
						color: "#1FCEF8",
					}
				}
    },
    yAxis: {
		// min:0,
		// max:100,
		// interval:10,
		splitNumber: 5,
		// interval:40,
        type: 'value',
			axisLabel: {
				formatter: '{value}%'
			},
			axisLine: {
						lineStyle: {
							color: "#1FCEF8",
						}
					}
			
    },
	grid: {
		top:'32%',
	    left: '3%',
	    right: '10%',
	    bottom: '3%',
	    containLabel: true
	},
     series: [
		
		{
			name:'公共安全感',
		    data: [100, 115, 105, 103, 100],
		    type: 'line',
		    areaStyle: {
				color:"#032C31",
			},
			itemStyle : {
				normal : {
					lineStyle:{ 
						color:'#11B58E'  
					}  
				}  
			}, 
		},
		{
			name:'法制建设满意度',
		    data: [0, 0, 105, 103, 100],
		    type: 'line',
		    areaStyle: {
				color:'#311832'
			},
			itemStyle : {
				normal : {
					lineStyle:{ 
						color:'#C33C68'  
					}  
				}  
			}, 
		}
		]
};

chart1.setOption(option1);


// 人民法院
let chart3 = echarts.init(document.getElementById('Chart-left3'));

option3 = {
    tooltip: {
        trigger: 'axis'
    },
    legend: {
        data: ['一审收案', '一审结案', '再审收案', '再审结案']
    },
    grid: {
		top:'25%',
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    // toolbox: {
    //     feature: {
    //         saveAsImage: {}
    //     }
    // },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['2013', '2014', '2015', '2016', '2017'],
		axisLine: {
					lineStyle: {
						color: "#1FCEF8",
					}
				}
    },	
    yAxis: {
        type: 'value',
		
		axisLine: {
					lineStyle: {
						color: "#1FCEF8",
					}
				}
    },
	 // yAxis: {
		// type: 'value',
		// min:0,
		// max:12000,
		// axisLabel:{
		// 	formatter: function (value) {
		// var texts = [];
		// 		if(value==0){
		// 			texts.push(0);
		// 		}
		// 		else if (value <=2000) {
		// 			texts.push(2000);
		// 		}
		// 		else if (value<= 4000) {
		// 			texts.push(4000);
		// 		}
		// 		else if(value<= 6000){
		// 			texts.push(6000);
		// 		}
		// 		else{
		// 			texts.push(12000);
		// 		}
		// 		return texts;
		// 	}
		// }
		// },
	legend: {
	            data: ["一审收案", "一审结案",'再审收案','再审结案'],
	            textStyle:{
	                color:"#fff"
	            }
	        },
    series: [
        {
            name: '一审收案',
            type: 'line',
            data: [12000,12000,12000,10000,11000]
        },
        {
            name: '一审结案',
            type: 'line',
            data: [5100,5100,5100,5500,5300]
        },
        {
            name: '再审收案',
            type: 'line',
            data: [4200,4200,3800,2100,3000]
        },
        {
            name: '再审结案',
            type: 'line',
            data: [1800,1800,1800,1800,1700]
        }
    ]
};

chart3.setOption(option3);


// 

// map.centerAndZoom({styleJson: styleJson1});


// 
let chart4 = echarts.init(document.querySelector('.Chart-in2'));

option4 = {
    title: {
        // text: '深圳月最低生活费组成（单位:元）',
        subtext: '单位：人',
		subtextStyle:{
			color:'#fff'
		}
		
        // sublink: 'http://e.weibo.com/1341556070/AjQH99che'
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
        },
        formatter: function (params) {
            var tar = params[1];
            return tar.name + '<br/>' + tar.seriesName + ' : ' + tar.value;
        }
    },
    grid: {
		top:'20%',
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'category',
		// boundaryGap: false,
        splitLine: {show: false},
        data: ['总数', '戴普镇', '石蝎村', '上皇镇', '细尾村', '天目湖镇','旧县','平成村'],
		axisLine: {
					lineStyle: {
						color: "#1FCEF8",
					}
				},
				axisLabel: {
					interval: 0,
				}
		
    },
    yAxis: {
        type: 'value',
		axisLine: {
					lineStyle: {
						color: "#1FCEF8",
					}
				}
    },
    series: [
        {
            name: '辅助',
            type: 'bar',
            stack: '总量',
            itemStyle: {
                barBorderColor: 'rgba(0,0,0,0)',
                color:'rgba(0,0,0,0)',
            },
            emphasis: {
                itemStyle: {
                    barBorderColor: 'rgba(0,0,0,0)',
                }
            },
            data: [0, 4408, 4500, 3800, 3200, 2500,1500,500]
        },
        {
            name: '总人数',
            type: 'bar',
            stack: '总量',
			itemStyle: {
			                barBorderColor: '#EE9A77',
			                color: '#EE9A77'
			            },
						
			 emphasis: {
						itemStyle: {
							barBorderColor: '#EE9A77',
							color: '#EE9A77'
						},
			        },
            label: {
                show: true,
                position: 'inside',
				color:"#fff"
            },
            data: [6548, 1592, 521, 158, 11, 115,18,25]
        }
    ]
};
chart4.setOption(option4);

let chart5 = echarts.init(document.querySelector('.Chart-right1'));
option5 = {
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '45%',
        containLabel: true
    },
    xAxis: {
        type: 'value',
        boundaryGap: [0, 0.01],
		axisLine: {
					lineStyle: {
						color: "#1FCEF8",
					}
				}
    },
    yAxis: {
        type: 'category',
        data: ['云南省', '贵州省', '湖北省', '江苏省', '安徽省'],
		axisLine: {
					lineStyle: {
						color: "#1FCEF8",
					}
				}
    },
    series: [
        {
            name: '人数',
            type: 'bar',
			barWidth:'50%',
			// itemStyle: {
			// 	normal:{
			// 		// barBorderColor: ['#826AF9','#FFE700'],
			// 		color: '#826AF9',
			// 	}
			               
			// },
			itemStyle: {
			            normal: {
			　　　　　　　　//这里是重点
			                color: function(params) {
			                	//注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
			                    var colorList = ['#826AF9','#FFE700', '#FF6C40', '#6CA842', '#1DC1DF'];
			                    return colorList[params.dataIndex]
			                }
			            }
			        },
			
            data: [280, 320, 360, 400, 430]
        },
		
    ]
};
chart5.setOption(option5);
window.addEventListener('mousewheel', function() {
	chart5.resize();
})


let chart6 = echarts.init(document.querySelector('.Chart-right2'));
option6 = {
    legend: {
        orient: 'horizontal',
        bottom:'0',
		left:'0',
        data: ['男', '女'],
		textStyle:{
		    color:"#fff"
		}
    },
	graphic:{
		                type:"text",
		                left:"17%",
		                top:"45%",
		                style:{
		                    text:"流入人口",
		                    textAlign:"center",
		                    fill:"#ffffff",
		                    fontSize:16,
		                    fontWeight:700
		                }
		            },
    series: [
		           
        {
            name: '性别',
            type: 'pie',
			center: ['25%', '50%'],
            radius: ['50%', '70%'],
            avoidLabelOverlap: false,
            label: {
                show: false,
                position: 'center'
            },
			itemStyle: {
			            normal: {
			　　　　　　　　//这里是重点
			                color: function(params) {
			                    var colorList = ['#2D99FF','#EE496D'];
			                    return colorList[params.dataIndex]
			                }
			            }
			        },
            labelLine: {
                show: false
            },
            data: [
                {value: 435, name: '男'},
                {value: 310, name: '女'},
            ]
        },
    ],
};
chart6.setOption(option6);

let chart7 = echarts.init(document.querySelector('.Chart-right3'));
option7 = {
    legend: {
        orient: 'horizontal',
        bottom:'0',
		left:'0',
        data: ['男', '女'],
		textStyle:{
		    color:"#fff"
		}
    },
		graphic:{
						type:"text",
						left:"35%",
						top:"45%",
						style:{
							text:"流出人口",
							textAlign:"center",
							fill:"#ffffff",
							fontSize:16,
							fontWeight:700
						}
					},
    series: [
		{
		    name: '性别',
		    type: 'pie',
			center: ['50%', '50%'],
		    radius: ['50%', '70%'],
		    avoidLabelOverlap: false,
		    label: {
		        show: false,
		        position: 'center'
		    },
			itemStyle: {
			            normal: {
			　　　　　　　　//这里是重点
			                color: function(params) {
			                    var colorList = ['#2D99FF','#EE496D'];
			                    return colorList[params.dataIndex]
			                }
			            }
			        },
		    labelLine: {
		        show: false
		    },
		    data: [
		        {value: 435, name: '男'},
		        {value: 310, name: '女'},
		    ]
		}
    ],
};
chart7.setOption(option7);

window.addEventListener('mousewheel', function() {
	chart1.resize();
})
window.addEventListener('mousewheel', function() {
	chart2.resize();
})
window.addEventListener('mousewheel', function() {
	chart3.resize();
})
window.addEventListener('mousewheel', function() {
	chart4.resize();
})
window.addEventListener('mousewheel', function() {
	chart6.resize();
})
window.addEventListener('mousewheel', function() {
	chart7.resize();
})
window.addEventListener('mousewheel', function() {
	chart8.resize();
})
window.addEventListener('mousewheel', function() {
	chart9.resize();
})
window.addEventListener('mousewheel', function() {
	chart10.resize();
})


function time(){
	
	var date = new Date();
	
	var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
	var min = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
	var sec = date.getSeconds() < 10 ? "0" + date.getSeconds()  : date.getSeconds();
	
	return hour + ":" + min + ":" + sec;
}

// console.log(flag)
setInterval(function(){
	var flag = time();
	$('.head-p').text(flag)
},1000);

function time1(){
	var date = new Date();
	var year = date.getFullYear();
	var month = date.getMonth()+1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth()+1;
	var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
	return year + "-" + month + "-" + day ;
}
setInterval(function(){
	var flag1 = time1();
	$('.head-p2').text(flag1);
},1000);

function time2(){
	var date = new Date();
	var week = date.getDay();
	
	switch(week){
		case 0:
			return '星期日';
			break;
		case 1:
			return '星期一';
			break;
		case 2:
			return '星期二';
			break;
		case 3:
			return '星期三';
			break;
		case 4:
			return '星期四';
			break;
		case 5:
			return '星期五';
			break;
		case 6:
			return '星期六';
			break;
	}
}
setInterval(function(){
	var flag2 = time2();
	$('.head-p1').text(flag2);
},1000)


// window.onresize = function(){
// 		chart1.resize();
// 		chart2.resize();
// 		chart3.resize();
// 		chart4.resize();
// 		chart5.resize();
// 		chart6.resize();
// 		chart7.resize();
// 		chart8.resize();
// 		chart9.resize();
// 		chart10.resize();
// }